/*******************************************OVERVIEW*******************************************************
 
 Political Shocks and Asset Prices
 
 Replication do file
 
 Appendix D: Long Memory
 
 Version July 29 2021 
 
  
********************************************************************************************************************/

clear
set more off
#delimit ;

cd "/Users/ssaiegh/Files/Mac/UCSD/Carnahan/Shocks/Replication Files";

log using "Appendix D", replace text;

use "daily_sp_argentina_2020.dta";

gen case_id= _n;

tsset case_id;

gen event=(steward==1 | gov_change==1 | dem_change==1 | elec==1 | terror==1);

gen ret_nom=log(nominal/L.nominal);
gen ret_inf=log(inflation/L.inflation);
gen ret_dol=log(dollar/L.dollar);

/* Table D1: Fractional Difference Parameter ARFIMA model*/; 

arfima ret_nom, ar(1) ma(1);

arfima ret_inf, ar(1) ma(1);

arfima ret_dol, ar(1) ma(1);

/* Table D2. Semi-Parametric Tests*/;


gphudak ret_nom, power(0.4 0.45: 0.6);

modlpr ret_nom, power( 0.4 0.45: 0.6);

roblpr ret_nom, power(0.4 0.45:0.6);

lomodrs ret_nom;


gphudak ret_inf, power( 0.4 0.45: 0.6);

modlpr ret_inf, power( 0.4 0.45: 0.6);

roblpr ret_inf, power(0.4 0.45:0.6);

lomodrs ret_inf;


gphudak ret_dol, power( 0.4 0.45: 0.6);

modlpr ret_dol, power( 0.4 0.45: 0.6);

roblpr ret_dol, power(0.4 0.45:0.6);

lomodrs ret_dol;

/* Table D3. State Dependency*/;

roblpr ret_nom if year>1969 & year<1980, power(0.5);
roblpr ret_nom if year>1979 & year<1990, power(0.5);
roblpr ret_nom if year>1989 & year<2000, power(0.5);
roblpr ret_nom if year>1999 & year<2010, power(0.5);
roblpr ret_nom if year>2009 & year<2020, power(0.5);

roblpr ret_inf if year>1969 & year<1980, power(0.5);
roblpr ret_inf if year>1979 & year<1990, power(0.5);
roblpr ret_inf if year>1989 & year<2000, power(0.5);
roblpr ret_inf if year>1999 & year<2010, power(0.5);
roblpr ret_inf if year>2009 & year<2020, power(0.5);

roblpr ret_dol if year>1969 & year<1980, power(0.5);
roblpr ret_dol if year>1979 & year<1990, power(0.5);
roblpr ret_dol if year>1989 & year<2000, power(0.5);
roblpr ret_dol if year>1999 & year<2010, power(0.5);
roblpr ret_dol if year>2009 & year<2020, power(0.5);


log c;
